Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pkg-conf

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pkg-conf

Get namespaced config from the closest package.json

  • 1.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9M
decreased by-27.78%
Maintainers
1
Weekly downloads
 
Created

What is pkg-conf?

The pkg-conf npm package allows you to load configuration from the `package.json` file of your project. It helps in managing project-specific configurations in a centralized manner.

What are pkg-conf's main functionalities?

Load Configuration

This feature allows you to load configuration settings from the `package.json` file under a specific namespace (in this case, 'myApp'). The configuration is returned as a JavaScript object.

const pkgConf = require('pkg-conf');
(async () => {
  const config = await pkgConf('myApp');
  console.log(config);
})();

Default Values

You can provide default values for configuration settings. If the specified configuration is not found in the `package.json` file, the default values will be used.

const pkgConf = require('pkg-conf');
(async () => {
  const config = await pkgConf('myApp', { default: 'value' });
  console.log(config);
})();

Sync Loading

This feature allows you to load configuration settings synchronously. This can be useful in scenarios where asynchronous operations are not suitable.

const pkgConf = require('pkg-conf');
const config = pkgConf.sync('myApp');
console.log(config);

Other packages similar to pkg-conf

Keywords

FAQs

Package last updated on 24 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc